// /home/san/Projects/sanfs/InventoryScanner/Main.cs created with MonoDevelop
// User: san at 4:55 PM 5/19/2007
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//
// project created on 5/19/2007 at 4:55 PM
using System;
using System.Xml;
using System.Collections;
using System.Collections.Generic;
using SanFS.DiscLibrary;
using SanFS.MediaChangerLibrary;
using SanFS.MediaChangerService;

namespace Mehat.San.Inventory
{
	class MainClass
	{
		public static void Main(string[] args)
		{
            //IMediaChangerDriver mcd = new MediaChangerDriver.MtxDriver("/usr/local/sbin/mtx -f /dev/sg9 altquerymode");
            //IMediaChangerDriver mcd = new VirtualDriver("/tmp");
            //IMediaChanger       mc = new MediaChanger(mcd);

            MediaChangerService  mcs = new MediaChangerService(null);
            while (true)
            {
                Console.Write(":> ");
                string  line = Console.ReadLine().ToLower();
                string  []tokens = line.Split(null);

                if (tokens[0] == "scaninventory" && tokens.Length == 3)
                {
                    try
                    {
                        IJobRequest rq = mcs.ScanInventory(Convert.ToInt32(tokens[1]), Convert.ToInt32(tokens[2]));
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error - ({0})", ex.Message);
                    }
                }
                if (line == "start")
                    mcs.Start();
                if (line == "stop")
                    mcs.Stop();
            }
		}
	}  // END CLASS
}  // END NAMESPACE